package com.shopReduce.sql;

import org.apache.commons.lang.StringUtils;

import com.shopReduce.bean.ReduceProgramme;

public class ReduceProgrammeBuilder {

	
	public String list(ReduceProgramme search) {
		StringBuilder sql = new StringBuilder("select * from sys_reduce_programme where 1=1");
		if(StringUtils.isNotBlank(search.getName())) {
			sql.append(" and name=#{name}");
		}
		if(StringUtils.isNotBlank(search.getId())) {
			sql.append(" and id=#{id}");
		}
		sql.append(" limit #{start},#{row}");
		return sql.toString();
	}
	public String listCount(ReduceProgramme search) {
		StringBuilder sql = new StringBuilder("select count(1) from sys_reduce_programme where 1=1");
		if(StringUtils.isNotBlank(search.getName())) {
			sql.append(" and name=#{name}");
		}
		if(StringUtils.isNotBlank(search.getId())) {
			sql.append(" and id=#{id}");
		}
		return sql.toString();
	}
	//
}
